﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Framework.Define;

namespace Framework.UI
{
    public class PanelBase<C, V> : MonoBehaviour, IPanelBase
        where C : ControllerBase<V>
        where V : ViewBase<C>
    {
        protected C mController;
        protected V mView;

        public virtual CanvasType CanvasType
        {
            get { return CanvasType.BaseCanvas; }
        }

        public void Init()
        {
            mView = gameObject.AddComponent<V>();
            mController = gameObject.AddComponent<C>();

            mView.Init();
            mController.Init();

            OnInit();
        }

        protected virtual void OnInit() { }
    }
}